<template>
  <div class="tab-bar-itme" @click="itmeClick()">
    <div v-if="!isActive"><slot name="itme-icon"></slot></div>
    <div v-else><slot name="itme-icon-active"></slot></div>
    <div :style="activeStyle"><slot name="itme-text"></slot></div>
  </div>
</template>

<script>
export default {
  name: "TabBarItme",
  props: {
    path: String,
    activeColor: {
      type: String,
      default: 'red'
    }
  },
  data() {
    return {
      // isActive: true,
    };
  },
  computed: {
    isActive() {
      return this.$route.path.indexOf(this.path) !== -1;
    },
    activeStyle() {
      return this.isActive ? {color: this.activeColor}: {};
    }
  },
  methods: {
    itmeClick() {
      this.$router.replace(this.path);
    },
  },
};
</script>
<style scoped>
.tab-bar-itme {
  flex: 1;
  text-align: center;
  height: 49px;
  font-size: 13px;
}

.tab-bar-itme img {
  height: 25px;
  width: 25px;
}
</style>